Text generation strategies
model.generate()について
model.generation_config
The default generation configuration limits the size of the output combined with the input prompt to a maximum of 20 tokens to avoid running into resource limitations.
Decoding strategies
Greedy search
generate はデフォルトで貪欲探索デコーディングを使用する
パラメータ num_beams が 1 に設定され、do_sample=False である
Contrastive search
コントラスティブ検索の動作を有効にし、制御する2つの主要なパラメータは「penalty_alpha」と「top_k」です
Multinomial sampling
多項分布サンプリングを有効にするには、do_sample=True および num_beams=1 を設定します。
Beam-search decoding
num_beams(追跡する仮説の数)を1よりも大きな値に指定します。
Beam-search multinomial sampling
num_beams を1より大きな値に設定し、do_sample=True を設定する
Diverse beam search decoding
Assisted Decoding